function displayTable(){
//    alert($("#moduleSelect").val());
    var module = $("#moduleSelect").val();
    var month = $("#monthSelect").val();
    $.post("/query",
    {
      "module" : module,
      "month" : month
    },
    function(data){
        console.log(data)
        loadResults(data)
    });
}

function displayTableArr(){
    var moduleArr = new Array();
    var i = 0;

      $("#moduleSelect option").each(function () {
             var txt = $(this).text(); //获取单个text
             var val = $(this).val(); //获取单个value

             moduleArr.push(val);

         });
      var monthValue = $("#monthSelect").val();

    console.log(moduleArr);
    var month = $("#monthSelect").val();
    var param = {module: moduleArr, month:monthValue}
//    alert(param.module)
//    alert(JSON.stringify(param));
    $.ajax({
        url: "/moduleBatchquery",
        type: "POST",
        data: JSON.stringify(param),
        contentType: "application/json; charset=utf-8",
        success: function(data) {
            console.log(data)
            loadResults(data)
        }
    });

}

function loadResults(data) {
    $.each(data, function (index, elementStr) {
      var no = index + 1;

      var element = jQuery.parseJSON(elementStr);

      var elementTr = '<td>' + element.module + '</td>';
      elementTr += '<td>' + element.month + '</td>';
      elementTr += '<td>' + element.codeLineNum + '</td>';
      elementTr += '<td>' + element.bugNum + '</td>';
      elementTr += '<td>' + element.bugRate + '</td>';
      lineNum = parseInt(element.codeLineNum)
      bugrate = parseFloat(element.bugRate)
      console.log(lineNum)
      if( bugrate > 0.001){
        elementTr = '<tr class="danger">' + elementTr + '</tr>';
      }else{
        elementTr = '<tr>' + elementTr + '</tr>';
      }

      console.log(elementTr);
      $('tbody#dataList').append(elementTr);
    })
    $('#codeLineDetail').show();
    $('tbody#dataList').show();
//    addPagBar('tbody#final_dataList', 'final_pagination', pageSize, 1);
}
